AKS doodle

As a minor exercise, I created an AKS cluster (just to see how it compares to my previous experience, where I ran it on bare metal). In the process I established, compared to the blood-and-sweat struggle to set up a cluster on bare metal (I am not talking about the likes of Minikube – rather k3s on physical/virtual hosts); where you actually have to set up master nodes, worker nodes, networking, load balancers, HA proxy and soo many other things – setting up a cloud cluster from scratch is unsurprisingly a few minute exercise. Probably the longest part was to figure out how to apply the guides – which were assuming you work with vanilla Terraform – to use Terragrunt. (I do prefer Terragrunt, `cause of dependencies and all compared to the unwrapped TF).
I first created a few (well, for this one only one is relevant) resource groups. I am not going to detail it here, as it is not that relevant; you can create these from the AZ GUI if you like. I set the following files:
# cat terragrunt.hcl
include {
path = find_in_parent_folders()
}
dependencies {
paths = ["../resource-groups"]
}
# cat main.tf
resource "azurerm_kubernetes_cluster" "cluster" {
name = "fabricesemti"
location = "northeurope"
resource_group_name = "my-aks-rg"
dns_prefix = "fabricesemti"
default_node_pool {
name = "default"
node_count = "2"
vm_size = "standard_d2_v2"
}
identity {
type = "SystemAssigned"
}
}
# cat outputs.tf
resource "local_file" "kubeconfig" {
depends_on = [azurerm_kubernetes_cluster.cluster]
filename = "kubeconfig"
content = azurerm_kubernetes_cluster.cluster.kube_config_raw
}
This took ~5 min and set up a 2-node cluster. Added the kubeconfig to my default config cp kubeconfig ~/.kube/config
Next, I grabbed a sample app and deployed it to my cluster
k apply -f https://raw.githubusercontent.com/Azure-Samples/azure-voting-app-redis/master/azure-vote-all-in-one-redis.yaml
Warning: spec.template.spec.nodeSelector[beta.kubernetes.io/os]: deprecated since v1.14; use "kubernetes.io/os" instead
deployment.apps/azure-vote-back created
service/azure-vote-back created
deployment.apps/azure-vote-front created
service/azure-vote-front created
Looks good according to Kubectl
default pod/azure-vote-back-6fcdc5cbd5-zw69n 1/1 Running 0 6m29s
default pod/azure-vote-front-5f4b8d498-pshzq 1/1 Running 0 6m29s
default service/azure-vote-back ClusterIP 10.0.111.97 <none> 6379/TCP 6m30s
default service/azure-vote-front LoadBalancer 10.0.200.188 20.67.177.50 80:30158/TCP 6m30s
default deployment.apps/azure-vote-back 1/1 1 1 6m30s
default deployment.apps/azure-vote-front 1/1 1 1 6m30s
default replicaset.apps/azure-vote-back-6fcdc5cbd5 1 1 1 6m30s
default replicaset.apps/azure-vote-front-5f4b8d498 1 1 1 6m30s
And the browser seems to agree too